<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // var obj = {
        //     age: 20,
        //     say: () => {
        //         console.log(this.age)
        //     }
        // }
        // obj.say.call(this)
        // obj.say();

        class bowl{
            constructor(name){
                //添加属性
                this.name=name;
            }
            fn1(){
                console.log(this.name+'吃米饭')
            }
            fn2(){
                console.log(this.name+'喝白粥')
            }
            fn3(){
                console.log(this.name+'喝瘦肉粥喝白粥')
            }
        }

        // 实例化 
    var xm =new bowl('小明')
    //调用方法
    xm.fn1();
    xm.fn2();
    xm.fn3();

    </script>
</body>

</html>